<?php
//Global variables
global $db, $user;


//Database
$db = new Database(DB_HOST, DB_NAME, DB_USER, DB_PASSWORD);

//Page name
$tmp = strrpos($_SERVER['PHP_SELF'], '/') + 1;
$pageName = substr($_SERVER['PHP_SELF'], $tmp, strlen($_SERVER['PHP_SELF']) - $tmp - 4 );
unset($tmp);

//Admin login
if (isset($_SESSION['userAdmin'])){
	//Verification dans la base
}elseif($pageName != 'login'){
	Tools::redirect('login.php');
}else{	
	if (isset($_POST['login'])){
		if ($_POST['user'] == 'admin' && $_POST['password'] == 'gaet4no'){
			$_SESSION['userAdmin'] = true;
			echo 'e';
			Tools::redirect('index.php');
		}else{
			$error = true;
		}
	}
}

//Action form
$requestURI = $_SERVER['PHP_SELF'];
//Configuration de l'entete des pages
$headerConfiguration = new HeaderConfiguration();

?>